package com.hex.ds.hdrs.period.task.converter;

import com.hex.ds.hdrs.common.utils.BaseUtil;
import com.hex.ds.hdrs.common.utils.HdrsDateUtil;
import com.hex.ds.hdrs.period.task.dto.PeriodTaskDto;
import com.hex.ds.hdrs.period.task.po.PeriodTask;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring", imports = {BaseUtil.class, HdrsDateUtil.class})
public interface IPeriodTaskConverter {

    PeriodTask toPeriodTaskForQuery(PeriodTaskDto periodTaskDto);

    @Mapping(target = "pkId", expression = "java(BaseUtil.getPkId())")
    @Mapping(target = "crtTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "upTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "taskStatus", source = "taskStatus")
    @Mapping(target = "bizDate", source = "bizDate")
    @Mapping(target = "execStTs", constant = "")
    @Mapping(target = "execEndTs", constant = "")
    PeriodTask copyPeriodTask(PeriodTask periodTask, String taskStatus, String bizDate);

}
